/*
 * Copyright 2022 Holoinsight Project Authors. Licensed under Apache-2.0.
 */

package io.holoinsight.server.home.task.crawler;

import com.google.gson.reflect.TypeToken;
import io.holoinsight.server.common.J;
import io.holoinsight.server.common.dao.entity.MetricInfo;
import io.holoinsight.server.common.dao.entity.dto.IntegrationMetricDTO;
import io.holoinsight.server.home.task.AbstractMetricCrawlerBuilder;
import io.holoinsight.server.home.task.MetricCrawler;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import static io.holoinsight.server.common.model.MetricCrawlerConstant.GLOBAL_ORGANIZATION;
import static io.holoinsight.server.common.model.MetricCrawlerConstant.GLOBAL_TENANT;
import static io.holoinsight.server.common.model.MetricCrawlerConstant.GLOBAL_WORKSPACE;
import static io.holoinsight.server.common.model.MetricCrawlerConstant.NUMBER_UNIT;

/**
 * @author jsy1001de
 * @version 1.0: MysqlMetricCrawlerBuilder.java, Date: 2023-05-15 Time: 16:35
 */
@Service
@Slf4j
@MetricCrawler(code = "io.holoinsight.plugin.MysqlPlugin")
public class MysqlMetricCrawlerBuilder extends AbstractMetricCrawlerBuilder {
  @Override
  protected List<MetricInfo> getMetricInfoList(String metric, List<String> tags,
      MetricInfo metricInfoTemplate) {

    List<MetricInfo> metricInfoList = new ArrayList<>();
    Map<String, List<IntegrationMetricDTO>> listMap = J.fromJson(metricData,
        new TypeToken<Map<String, List<IntegrationMetricDTO>>>() {}.getType());
    listMap.forEach((k, v) -> {
      if (CollectionUtils.isEmpty(v))
        return;
      for (IntegrationMetricDTO metricDTO : v) {
        String[] array = StringUtils.split(metricDTO.getName(), "_");
        metricInfoList.add(genMetricInfo(GLOBAL_TENANT, GLOBAL_WORKSPACE, GLOBAL_ORGANIZATION,
            "mysql", k, metricDTO.getName().substring(11), metricDTO.getName(),
            StringUtils.join(array, ' '), NUMBER_UNIT, 60, tags));
      }
    });

    return metricInfoList;
  }

  private static String metricData = "{\n" + "    \"subMetrics\":{\n" + "        \"CONNECTION\":[\n"
      + "            {\n" + "                \"name\":\"mysql_connection_errors_accept\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_connection_errors_internal\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_connection_errors_max_connections\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_connection_errors_peer_address\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_connections\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_connection_errors_select\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_connection_errors_tcpwrap\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_max_used_connections\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_max_used_connections_time\"\n" + "            }\n"
      + "        ],\n" + "        \"TABLE\":[\n" + "            {\n"
      + "                \"name\":\"mysql_created_tmp_tables\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_created_tmp_disk_tables\"\n"
      + "            },\n" + "            {\n" + "                \"name\":\"mysql_open_tables\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_open_table_definitions\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_opened_tables\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_opened_table_definitions\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_table_locks_immediate\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_table_open_cache_misses\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_table_locks_waited\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_table_open_cache_overflows\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_slave_open_temp_tables\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_table_open_cache_hits\"\n" + "            }\n"
      + "        ],\n" + "        \"SYSTEM\":[\n" + "            {\n"
      + "                \"name\":\"mysql_aborted_clients\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_aborted_connects\"\n"
      + "            },\n" + "            {\n" + "                \"name\":\"mysql_bytes_sent\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_bytes_received\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_delayed_errors\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_delayed_insert_threads\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_created_tmp_files\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_delayed_writes\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_flush_commands\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_key_blocks_unused\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_key_reads\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_max_execution_time_set_failed\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_key_blocks_not_flushed\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_key_write_requests\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_max_execution_time_set\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_key_blocks_used\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_key_read_requests\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_key_writes\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_max_execution_time_exceeded\"\n"
      + "            },\n" + "            {\n" + "                \"name\":\"mysql_open_streams\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_not_flushed_delayed_rows\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_open_files\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_opened_files\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_select_scan\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_sort_rows\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_sort_scan\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_select_full_join\"\n"
      + "            },\n" + "            {\n" + "                \"name\":\"mysql_questions\"\n"
      + "            },\n" + "            {\n" + "                \"name\":\"mysql_slow_queries\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_prepared_stmt_count\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_select_range\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_slow_launch_threads\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_sort_merge_passes\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_sort_range\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_queries\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_select_range_check\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_select_full_range_join\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_tc_log_max_pages_used\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_tc_log_page_size\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_threads_cached\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_threads_created\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_threads_running\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_tc_log_page_waits\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_threads_connected\"\n"
      + "            },\n" + "            {\n" + "                \"name\":\"mysql_uptime\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_uptime_since_flush_status\"\n" + "            }\n"
      + "        ],\n" + "        \"INNODB\":[\n" + "            {\n"
      + "                \"name\":\"mysql_innodb_buffer_pool_load_status\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_innodb_buffer_pool_pages_data\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_innodb_buffer_pool_bytes_dirty\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_innodb_buffer_pool_read_ahead_rnd\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_innodb_buffer_pool_pages_total\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_innodb_buffer_pool_resize_status\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_innodb_buffer_pool_bytes_data\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_innodb_buffer_pool_pages_free\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_innodb_buffer_pool_dump_status\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_innodb_buffer_pool_pages_dirty\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_innodb_buffer_pool_pages_flushed\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_innodb_buffer_pool_pages_misc\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_innodb_log_write_requests\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_innodb_buffer_pool_read_ahead\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_innodb_buffer_pool_reads\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_innodb_data_pending_fsyncs\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_innodb_data_pending_reads\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_innodb_data_reads\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_innodb_dblwr_writes\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_innodb_buffer_pool_wait_free\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_innodb_buffer_pool_write_requests\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_innodb_data_fsyncs\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_innodb_data_written\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_innodb_buffer_pool_read_requests\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_innodb_data_pending_writes\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_innodb_data_writes\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_innodb_log_waits\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_innodb_log_writes\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_innodb_os_log_fsyncs\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_innodb_buffer_pool_read_ahead_evicted\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_innodb_data_read\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_innodb_dblwr_pages_written\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_innodb_redo_log_enabled\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_innodb_row_lock_time\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_innodb_row_lock_time_avg\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_innodb_rows_inserted\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_innodb_page_size\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_innodb_row_lock_current_waits\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_innodb_rows_read\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_innodb_rows_updated\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_innodb_system_rows_read\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_innodb_os_log_pending_writes\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_innodb_row_lock_time_max\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_innodb_rows_deleted\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_innodb_system_rows_deleted\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_innodb_system_rows_inserted\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_innodb_pages_read\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_innodb_os_log_written\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_innodb_pages_created\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_innodb_pages_written\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_innodb_row_lock_waits\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_innodb_os_log_pending_fsyncs\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_innodb_system_rows_updated\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_innodb_truncated_status_writes\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_innodb_undo_tablespaces_explicit\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_innodb_sampled_pages_read\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_innodb_sampled_pages_skipped\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_innodb_undo_tablespaces_implicit\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_innodb_num_open_files\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_innodb_undo_tablespaces_total\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_innodb_undo_tablespaces_active\"\n" + "            }\n"
      + "        ],\n" + "        \"PERFORMANCE\":[\n" + "            {\n"
      + "                \"name\":\"mysql_performance_schema_file_handles_lost\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_performance_schema_locker_lost\"\n" + "            },\n"
      + "            {\n"
      + "                \"name\":\"mysql_performance_schema_memory_classes_lost\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_performance_schema_digest_lost\"\n" + "            },\n"
      + "            {\n"
      + "                \"name\":\"mysql_performance_schema_cond_instances_lost\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_performance_schema_file_instances_lost\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_performance_schema_hosts_lost\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_performance_schema_accounts_lost\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_performance_schema_cond_classes_lost\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_performance_schema_file_classes_lost\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_performance_schema_index_stat_lost\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_performance_schema_thread_instances_lost\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_performance_schema_metadata_lock_lost\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_performance_schema_mutex_classes_lost\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_performance_schema_program_lost\"\n" + "            },\n"
      + "            {\n"
      + "                \"name\":\"mysql_performance_schema_rwlock_classes_lost\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_performance_schema_rwlock_instances_lost\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_performance_schema_table_instances_lost\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_performance_schema_nested_statement_lost\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_performance_schema_prepared_statements_lost\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_performance_schema_session_connect_attrs_longest_seen\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_performance_schema_socket_classes_lost\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_performance_schema_table_lock_stat_lost\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_performance_schema_users_lost\"\n" + "            },\n"
      + "            {\n"
      + "                \"name\":\"mysql_performance_schema_mutex_instances_lost\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_performance_schema_session_connect_attrs_lost\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_performance_schema_socket_instances_lost\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_performance_schema_table_handles_lost\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_performance_schema_thread_classes_lost\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_performance_schema_stage_classes_lost\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_performance_schema_statement_classes_lost\"\n"
      + "            }\n" + "        ],\n" + "        \"COMMAND\":[\n" + "            {\n"
      + "                \"name\":\"mysql_commands_alter_function\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_commands_alter_resource_group\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_commands_alter_server\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_commands_alter_user\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_commands_analyze\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_commands_assign_to_keycache\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_commands_alter_event\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_commands_alter_tablespace\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_commands_alter_user_default_role\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_commands_alter_procedure\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_commands_alter_table\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_commands_admin_commands\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_commands_alter_db\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_commands_alter_instance\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_commands_begin\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_commands_binlog\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_commands_change_db\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_commands_change_repl_filter\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_commands_commit\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_commands_create_resource_group\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_commands_create_trigger\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_commands_call_procedure\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_commands_clone\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_commands_create_server\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_commands_create_table\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_commands_check\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_commands_create_db\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_commands_create_event\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_commands_create_function\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_commands_checksum\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_commands_change_replication_source\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_commands_create_index\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_commands_create_procedure\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_commands_create_role\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_commands_create_udf\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_commands_change_master\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_commands_drop_db\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_commands_drop_trigger\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_commands_drop_event\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_commands_drop_index\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_commands_drop_resource_group\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_commands_drop_table\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_commands_drop_view\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_commands_create_spatial_reference_system\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_commands_dealloc_sql\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_commands_do\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_commands_drop_function\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_commands_drop_procedure\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_commands_delete_multi\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_commands_drop_role\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_commands_drop_server\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_commands_drop_spatial_reference_system\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_commands_drop_user\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_commands_create_user\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_commands_create_view\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_commands_delete\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_commands_grant_roles\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_commands_ha_open\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_commands_lock_instance\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_commands_lock_tables\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_commands_insert_select\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_commands_kill\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_commands_empty_query\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_commands_execute_sql\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_commands_explain_other\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_commands_help\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_commands_import\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_commands_load\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_commands_grant\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_commands_ha_close\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_commands_ha_read\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_commands_insert\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_commands_install_component\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_commands_flush\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_commands_get_diagnostics\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_commands_install_plugin\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_commands_restart\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_commands_rollback\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_commands_rollback_to_savepoint\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_commands_preload_keys\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_commands_release_savepoint\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_commands_rename_table\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_commands_replace_select\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_commands_revoke_all\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_commands_optimize\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_commands_prepare_sql\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_commands_replace\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_commands_revoke\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_commands_purge_before_date\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_commands_reset\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_commands_revoke_roles\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_commands_savepoint\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_commands_purge\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_commands_rename_user\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_commands_repair\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_commands_resignal\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_commands_signal\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_commands_show_create_func\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_commands_set_password\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_commands_set_resource_group\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_commands_show_binlog_events\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_commands_show_create_db\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_commands_show_create_proc\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_commands_show_create_table\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_commands_show_create_trigger\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_commands_show_databases\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_commands_show_engine_status\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_commands_set_option\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_commands_show_binlogs\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_commands_show_charsets\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_commands_show_engine_logs\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_commands_select\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_commands_set_role\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_commands_show_collations\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_commands_show_create_event\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_commands_show_engine_mutex\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_commands_show_events\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_commands_show_grants\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_commands_show_privileges\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_commands_show_profile\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_commands_show_master_status\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_commands_show_profiles\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_commands_show_relaylog_events\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_commands_show_replicas\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_commands_show_replica_status\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_commands_show_fields\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_commands_show_function_code\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_commands_show_function_status\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_commands_show_keys\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_commands_show_open_tables\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_commands_show_plugins\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_commands_show_procedure_code\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_commands_show_procedure_status\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_commands_show_processlist\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_commands_show_slave_hosts\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_commands_show_errors\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_commands_slave_start\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_commands_stmt_execute\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_commands_replica_stop\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_commands_group_replication_start\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_commands_show_table_status\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_commands_show_warnings\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_commands_show_variables\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_commands_slave_stop\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_commands_group_replication_stop\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_commands_stmt_fetch\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_commands_show_slave_status\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_commands_show_storage_engines\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_commands_show_triggers\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_commands_show_create_user\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_commands_shutdown\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_commands_replica_start\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_commands_stmt_close\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_commands_stmt_prepare\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_commands_show_status\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_commands_show_tables\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_commands_unlock_instance\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_commands_xa_end\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_commands_xa_recover\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_commands_stmt_reset\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_commands_uninstall_plugin\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_commands_xa_start\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_commands_stmt_reprepare\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_commands_uninstall_component\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_commands_unlock_tables\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_commands_update_multi\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_commands_xa_commit\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_commands_xa_rollback\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_commands_truncate\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_commands_update\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_commands_stmt_send_long_data\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_commands_xa_prepare\"\n"
      + "            }\n" + "        ],\n" + "        \"HANDLER\":[\n" + "            {\n"
      + "                \"name\":\"mysql_handler_read_last\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_handler_read_next\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_handler_discover\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_handler_mrr_init\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_handler_prepare\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_handler_delete\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_handler_external_lock\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_handler_read_first\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_handler_commit\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_handler_read_key\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_handler_savepoint_rollback\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_handler_write\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_handler_read_rnd\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_handler_rollback\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_handler_savepoint\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_handler_update\"\n"
      + "            },\n" + "            {\n"
      + "                \"name\":\"mysql_handler_read_prev\"\n" + "            },\n"
      + "            {\n" + "                \"name\":\"mysql_handler_read_rnd_next\"\n"
      + "            }\n" + "        ]\n" + "    }\n" + "}";



}
